package org.edu.modules.pub.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.edu.common.api.vo.Result;
import org.edu.common.aspect.annotation.AutoLog;
import org.edu.common.system.base.controller.BaseController;
import org.edu.common.system.query.QueryGenerator;
import org.edu.modules.pub.entity.VeJwJianzhu;
import org.edu.modules.pub.service.IVeJwJianzhuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @Description: 全校不排课时间
 * @Author:
 * @Date:   2021-05-12
 * @Version: V1.0
 */
@Api(tags="建筑教室信息")
@RestController
@RequestMapping("/pub/veJwJianzhu")
@Slf4j
public class VeJwJianzhuController extends BaseController<VeJwJianzhu, IVeJwJianzhuService> {
    @Autowired
    private IVeJwJianzhuService veJwJianzhuService;

    /**
     * 分页查询
     * @param veJwJianzhu
     * @param pageNo
     * @param pageSize
     * @param req
     * @return
     */
    @AutoLog(value = "学校建筑信息-分页查询")
    @ApiOperation(value="建筑列表查询", notes="学校建筑信息-分页查询")
    @PostMapping(value = "/list")
    public Result<?> queryPageList(VeJwJianzhu veJwJianzhu,
                                   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                   @RequestParam(name="pageSize", defaultValue="99") Integer pageSize,
                                   HttpServletRequest req) {
        QueryWrapper<VeJwJianzhu> queryWrapper = QueryGenerator.initQueryWrapper(veJwJianzhu, req.getParameterMap());
        Page<VeJwJianzhu> page = new Page<VeJwJianzhu>(pageNo, pageSize);
        IPage<VeJwJianzhu> pageList = veJwJianzhuService.page(page, queryWrapper);
        return Result.OK(pageList);
    }


}